package cn.wolfcode.mapper;

import cn.wolfcode.domain.Employee;
import cn.wolfcode.qo.QueryObject;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface EmployeeMapper {
    int deleteByPrimaryKey(Long id);

    int insert(Employee employee);
    int updateByPrimaryKey(Employee employee);
    // 单个查询
    Employee selectByPrimaryKey(Long id);
    // 分页查询
    List<Employee> selectForList(QueryObject qo);
    // 全部查询
    List<Employee> selectAll();

    // 删除跟员工关系的数据
    void deleteRelation(Long employeeId);

    // 通过员工id插入关系 => 中间表
    void insertRelation(@Param("employeeId") Long id, @Param("roleId") Long roleId);

    // 查询用户名是否存在
    Employee checkUsername(String username);

    // 登录查询用户是否存在
    Employee selectByUsernameAndPassword(@Param("username") String username, @Param("password") String password);

    Employee selectByUsername(String username);
}